import http from "../utils/request"

//首页热度文章 /home/getArticle
const getArticle = (data = {}) => {
  return http.request({
    url: "/home/getArticle",
    method: 'get',
    data: data
  })
}

//首页搜索文章
const articlePage = (data) => {
  return http.request({
    url: "/article/getArticlePage",
    method: 'get',
    data: data
  })
}

//文章点赞
const articleLike = (articleId) => {
  return http.request({
    url: "/article/like/" + articleId,
    method: 'get',
    data: {}
  })
}

//文章点踩
const articleDislike = (articleId) => {
  return http.request({
    url: "/article/dislike/" + articleId,
    method: 'get',
    data: {}
  })
}

//根据ID获取文章详情
const getArticleById = (id) => {
  return http.request({
    url: "/article/getArticleById/" + id,
    method: 'get',
    data: {}
  })
}

//校验密码
const checkPassword = (id, password) => {
  return http.request({
    url: "/article/checkPassword/" + id + "/" + password,
    method: 'get',
    data: {}
  })
}

export {
  getArticle,
  articlePage,
  articleLike,
  articleDislike,
  getArticleById,
  checkPassword,
}
